package lm.concurrency.day5.atomicReference.compareWiths;

import java.math.BigDecimal;

/**
 * @Auther: Min.Liu
 * @Description:
 * @Date: Created in 14:38 2024/11/7
 */
class DecimalAccountUnsafe implements DecimalAccount {
    BigDecimal balance;

    public DecimalAccountUnsafe(BigDecimal balance) {
        this.balance = balance;
    }

    @Override
    public BigDecimal getBalance() {
        return balance;
    }

    @Override
    public void withdraw(BigDecimal amount) {
        BigDecimal balance = this.getBalance();
        this.balance = balance.subtract(amount);
    }
}
